import 'package:flutter/material.dart';
import 'package:flutterapp/model/Boil.dart';
import 'package:flutterapp/myicon/MyIcons.dart';

class QuanziDetail extends StatefulWidget {
  final Boil arguments;

  QuanziDetail({Key? key,required this.arguments}) : super(key: key);

  _QuanziDetailState createState() => _QuanziDetailState(arguments:this.arguments);

}

class _QuanziDetailState extends State<QuanziDetail> {
  Boil arguments;
  _QuanziDetailState({required this.arguments});
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
          title: Text('圈子详情',
              style: TextStyle(
                fontSize: 20.0,
                color: Color.fromRGBO(85, 85, 85, 1.0),
              )),
          backgroundColor: Colors.white,
          automaticallyImplyLeading: true,
          foregroundColor: Color.fromRGBO(85, 85, 85, 1.0),
          shadowColor: Color.fromRGBO(254, 254, 254, 0.2)),
      body: HomeContent(),
    );
  }
}

class HomeContent extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Padding(padding: EdgeInsets.all(10),child: Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
          Padding(padding: EdgeInsets.fromLTRB(0, 8, 0, 0)),
          Row(children: <Widget>[
            buildCommonAvatar(context),
            Padding(padding: EdgeInsets.fromLTRB(10, 0, 0, 0)),
            buildTitle(context, "涛哥", '2021-11-01 12:00:00'),
            Padding(padding: EdgeInsets.fromLTRB(0, 8, 0, 0)),
          ]),
          buildText(context,"涛哥的内容不堪入目，帅气英俊"),
          buildIcon(context,"7878723","9527","10")
      ]
    ));
  }

  Widget buildCommonAvatar(BuildContext context) {
    return ClipOval(
            child: Image.asset('assets/images/a.jpeg',
              height: 40,
              width: 40,
              fit: BoxFit.cover,
            ),
        );
  }

   Widget buildTitle(BuildContext context, String userName, String time) {
    return Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[Text(userName), Text(time)]);
  }

  Widget buildText(BuildContext context,String content) {
       return Padding(
          padding: EdgeInsets.fromLTRB(0, 8, 0, 0),
          child: Text(
            content,
            style: TextStyle(
                  letterSpacing: 2.0,
                  // wordSpacing: 5.0
                ),
          )
        );
  }

  Widget buildIcon(BuildContext context,String eyeNum,String favNum,String commentNum) {
       return Padding(
          padding: EdgeInsets.fromLTRB(0, 10, 12, 0),
          child: Row(
             crossAxisAlignment: CrossAxisAlignment.center,   //内部容器垂直方向对齐方式
             children: [
               Icon(MyIcons.eye,size: 20,color: Colors.grey),
               SizedBox(width: 5),
               Text("187788"),
               Expanded(flex:1,child: SizedBox(width: 5)),
               Icon(MyIcons.like,size: 20,color: Colors.grey),
               SizedBox(width: 5),
               Text("9527"),
               SizedBox(width: 10),
               Icon(MyIcons.comment,size: 20,color: Colors.grey),
               SizedBox(width: 5),
               Text("8"),
             ],
          ),
       );
  }
}
